<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.eagle.commons.vo.tbl_PosOperatorDic"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>废票录入</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<jsp:include page="../common/easyui.jsp"></jsp:include>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/util.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/dateCommon/WdatePicker.js"></script>
	<script type='text/javascript' src="<%=request.getContextPath()%>/dwr/interface/PrintDwr.js"></script>
	 <script type="text/javascript">
	 <% tbl_PosOperatorDic posoper = (tbl_PosOperatorDic)session.getAttribute("posoper");
       	  Integer posID = posoper.getBL_PosID();
       %>
	 $(function(){		
	 });
	 //确定录入
	 function insert(){
	 	   var invID=  $("#invID").val();
	 	   var reason=  $("#reason").val();
	 	   var mon=  $("#mon").val();
	 	     var type=2;//手工录入
	 	     if (invID!="" && mon!="" && reason!="") {
	  	      PrintDwr.addFp(invID,reason,mon,type,function(data){
				if(data == "") {
				 $('#info')[0].reset();
				 $.messager.show({
				 title:'系统提示',
				 msg:'操作成功',
	 			 timeout:2000,
				 showType:'slide'
     			 });	
				 }else {
				 $.messager.show({
				 title:'系统提示',
				 msg:data,
	 			 timeout:2000,
				 showType:'slide'
     			 });	
				}
			});
			}else{
			 $.messager.show({
				 title:'系统提示',
				 msg:'信息不全！请填写完整信息',
	 			 timeout:2000,
				 showType:'slide'
     			 });	
			}
	 }
 	 function check(index){
 	 if(index==1){
 	  $.messager.alert('系统提示', '您选择了储值卡','info');
 	 }
 	 if(index==2){
 	 $.messager.show({
	 title:'系统提示',
	 msg:'您选择了记账卡',
	 timeout:2000,
	 showType:'slide'
     });
 	 }
 	 }   
 	 //获取当前票据号
 	 function getInvID(operid,status){
 	 PrintDwr.getInvID(operid,status,function(data){
 	 			data=data.split("-");
				if(data[0] != "") {
				 $("#num").val(data[0]);
				 $("#inv").val(data[1]);
					$('#dlg').dialog('open');
				}else {
				$.messager.alert('系统提示', data[1],'info');	
				}
			});
 	 }
 	 //检测原因长度
 	function isOver(maxLen){
    var opName = $("#reason").val();
    opName = String(opName).replace(/^[\s]+|[\s]+$/g,'');
    var len= opName.replace(/[^\x00-\xFF]/g,'**').length; 
    if(opName!="" && len>maxLen){
    msg("原因输入太长了");
    return false;
    }
    }
	 </script>
	 
  </head>
  
  <body>
   <div id="searchDiv" class="easyui-panel"  title="废票录入——查询提示" style="background-color:#EBF2FF;" collapsible="true">
		<p style="color: red;font-size: 20px">提示</p>
		<p style="margin-left: 20px">当票据出现以下情况时需要手动将其作废，录入到系统</p>
		<ul>
		<li>票据损坏</li>
		<li>字迹不清</li>
		</ul>
		<p style="margin-left: 20px">填写票号、作废原因</p>
	</div>
	 <div id="birt" class="easyui-panel"  title="废票录入" style="background-color:#EBF2FF;height: 350"  collapsible="true">
	  <form id="info" method="post">
	   <table style="margin-left: 100px;margin-top: 50px"> 
		<tr> 
		<td>票据编号:</td> 
		<td><input class="easyui-validatebox" required="true" validType="length[1,8]" maxlength='8' id="invID"></td> 
		</tr> 
		<tr> 
		<td>作废月份:</td> 
		<td><input id="mon" name="mon" class="Wdate" value="" type="text" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
						<span>格式为：<font color='red'>YYYY-MM--DD</font></span>
		</td> 
		</tr>
		<tr> 
		<td>作废原因:</td> 
		<td><textarea class="easyui-validatebox" required="true" style="height:50px;width: 200px" id="reason" onblur="isOver(100)"></textarea></td> 
		</tr> 
		<tr>
		<td colspan="2"><a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-ok" onclick="insert()" >确定</a>
              <a href="javascript:void(0)"  class="easyui-linkbutton" iconCls="icon-cancel" onclick=" $('#info')[0].reset();" >清空</a></td>
		</tr>
		</table> 
		</form>
	 </div>
  </body>
</html>
